package server;

import java.net.ServerSocket;
import java.net.Socket;


/**
 * @author lizuhu
 * @description
 * @date 2021/8/30 9:43
 */
public class ChatServer {

    public static void main(String[] args) {
        new ChatServer().start();
    }
    public void start() {
        try {
            ServerSocket server = new ServerSocket(10086);
            System.out.println("服务器创建成功，等待客户端连接.....");
            //监控客户端的连接
            while (true) {
                Socket socket = server.accept();
                new Thread(new ServerChannel(socket)).start();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
